<?php
namespace Admin\Api;

use Phalcon\DiInterface;
use Phalcon\Mvc\View;
use Phalcon\Loader;
use Phalcon\Mvc\ModuleDefinitionInterface;
use Phalcon\Mvc\Router\Annotations as RouterAnnotations;

/**
 * @SWG\Swagger(
 *   schemes={"http"},
 *   basePath="/",
 *   consumes={"text/html"},
 *   produces={"application/json"},
 *   @SWG\Info(
 *     version="1.0",
 *     title="学海新后台接口",
 *     description="获取新数据中心各类信息接口<br>
                    含有<strong>“分页”</strong>说明的不再单独写model，格式如下：<br />
                    {page: 页码, size: 行数, totalPage: 总页数, total: 总行数, rows: [{},{}]}",
 *     @SWG\Contact(email="ck@100fen.com"),
 *   ),
 *
 *   @SWG\Tag(
 *     name="Index",
 *     description="基础服务",
 *   ),
 *
 *   @SWG\Tag(
 *     name="User",
 *     description="用户信息",
 *   ),
 *
 *   @SWG\Tag(
 *     name="Info",
 *     description="学校等其他信息",
 *   ),
 *
 *   @SWG\Tag(
 *     name="Log",
 *     description="日志信息",
 *   ),
 *
 *   @SWG\Tag(
 *     name="Faq",
 *     description="常见问题及使用说明",
 *   )
 * )
 */

class Module implements ModuleDefinitionInterface
{
    /**
     * Registers an autoloader related to the module
     *
     * @param DiInterface $di
     */
    public function registerAutoloaders(DiInterface $di = null)
    {
        $loader = new Loader();

        $loader->registerNamespaces([
            'Admin\Api\Controllers'    => __DIR__ . '/controllers/',
            'Admin\Api\Models'         => __DIR__ . '/models/',
        ]);

        $loader->register();
    }

    /**
     * Registers services related to the module
     *
     * @param DiInterface $di
     */
    public function registerServices(DiInterface $di)
    {
        /**
         * Setting up the view component
         */
        $di->set('view', function () {
            $view = new View();
            $view->disable();
            return $view;
        });

    }
}
